package com.cddx.logistics.controller;

import com.cddx.logistics.domain.vo.PersonTaskStatisticsVo;
import com.cddx.logistics.service.PersonTaskStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/statistics/personTask")
public class PersonTaskStatisticsController {

    @Autowired
    private PersonTaskStatisticsService personTaskStatisticsService;

    @GetMapping("/monthly")
    public List<PersonTaskStatisticsVo> getMonthlyStatistics(
            @RequestParam(value = "year", required = false) Integer year,
            @RequestParam(value = "empName", required = false) String empName) {

        return personTaskStatisticsService.getPersonTaskStatistics(year, empName);
    }

    @GetMapping("/selectOptions")
    public Map<String, List<?>> getSelectOptions() {
        return personTaskStatisticsService.getSelectOptions();
    }
}
